-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Orientation listener in bridgeless mode #43971
Conversation
This pull request was exported from Phabricator. Differential Revision: D55871599 |
Summary: It turns out that we forgot to add a listener for the orientation change event in Bridgeless. We used to have `UIApplicationDidChangeStatusBarOrientationNotification` but this is slightly unreliable because there might be use cases where the status bar has been hidden and, therefore, the event is not triggered. This should fix an issue reported by OSS. ## Changelog: [iOS][Fixed] - Make sure that the New Architecture listens to orientation change events. Differential Revision: D55871599
7571ed1
to
8751b32
Compare
This pull request was exported from Phabricator. Differential Revision: D55871599 |
Also... |
This pull request has been merged in 49b0d26. |
This pull request was successfully merged by @cipolleschi in 49b0d26. When will my fix make it into a release? | How to file a pick request? |
Summary: Pull Request resolved: #43971 It turns out that we forgot to add a listener for the orientation change event in Bridgeless. We used to have `UIApplicationDidChangeStatusBarOrientationNotification` but this is slightly unreliable because there might be use cases where the status bar has been hidden and, therefore, the event is not triggered. This should fix an issue reported by OSS. ## Changelog: [iOS][Fixed] - Make sure that the New Architecture listens to orientation change events. Reviewed By: cortinico Differential Revision: D55871599 fbshipit-source-id: c9b0634ec2126aa7a6488c2c56c87a9610fa1adf
@@ -75,6 +75,10 @@ - (void)initialize | |||
selector:@selector(interfaceFrameDidChange) | |||
name:RCTWindowFrameDidChangeNotification | |||
object:nil]; | |||
[[NSNotificationCenter defaultCenter] addObserver:self | |||
selector:@selector(interfaceFrameDidChange) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cipolleschi Should that really be calling interfaceFrameDidChange
and not interfaceOrientationDidChange
instead? I'm currently investigating an issue on 0.74.1, where orientation changes are not propagated correctly by Dimensions
and/or useWindowDimensions
and the culprit seems to be that nothing updates the dimensions properly on orientation change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, after some more debugging - [self _exportedDimensions]
is always returning the previous dimension prior the orientation change, so the portrait dimensions when switching to landscape and vice versa. Is this related when the UIDeviceOrientationDidChangeNotification
event is triggered or related to when we gather the dimension data?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe related: https://snippet.zone/2022/11/
As well as: https://forums.developer.apple.com/forums/thread/713072
TL;DR it seems that the update of the bounds is not immediate.
Summary:
It turns out that we forgot to add a listener for the orientation change event in Bridgeless.
We used to have
UIApplicationDidChangeStatusBarOrientationNotification
but this is slightly unreliable because there might be use cases where the status bar has been hidden and, therefore, the event is not triggered.This should fix an issue reported by OSS.
Changelog:
[iOS][Fixed] - Make sure that the New Architecture listens to orientation change events.
Differential Revision: D55871599